package com.intelligent.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.intelligent.service.PaymentOrderService;
import com.intelligent.vo.PaymentOrderCreateReq;
import com.intelligent.vo.PaymentOrderPageReq;
import com.intelligent.vo.PaymentOrderResp;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/payment-order")
public class PaymentOrderController {

    @Resource
    private PaymentOrderService paymentOrderService;

    /**
     * 分页查询付款单
     */
    @PostMapping("/page")
    public Page<PaymentOrderResp> page(@RequestBody PaymentOrderPageReq req) {
        return paymentOrderService.page(req);
    }

    /**
     * 查看付款单详情
     */
    @GetMapping("/{id}")
    public PaymentOrderResp detail(@PathVariable Long id) {
        return paymentOrderService.detail(id);
    }

    /**
     * 新建付款单
     */
    @PostMapping("/create")
    public PaymentOrderResp create(@RequestBody PaymentOrderCreateReq req) {
        return paymentOrderService.create(req);
    }
}
